<?php
    $referral_code=1;
    ob_start();
    include('kk.php');
    $url =  "http://" . $_SERVER['HTTP_HOST'] . "/user.php?act=register&referral_code=" . $referral_code;
    $name = time();
    $filename = $name.'.png';
    $errorCorrectionLevel = 'L';
    $matrixPointSize = 10;
    
    QRcode::png($url);
    $imageString = base64_encode(ob_get_contents());
    
    ob_end_clean();
    $data = array(
        'code'=>200,
        'data'=>['qrcode' => $imageString, 'url' => $url, 'referral_code' => $referral_code]
    );
    exit( json_encode( $data));
?>